import {local} from './config'
export default function(url,data={},method="GET"){
  return new Promise((resolve, reject)=>{
    wx.request({
      url:local.host + url,
      data,
      method,
      header:{
        cookie:wx.getStorageSync('cookie')
      },
      success :(res)=>{
        resolve(res.data)
      },
      fail: (err) => {
        reject(err); // reject修改promise的状态为失败状态
      }
    })
  })

}